package com.fh.controller;

import com.fh.common.ResultMassage;
import com.fh.entity.Contract;
import com.fh.enums.ResultEnum;
import com.fh.vo.ContractVo;
import org.springframework.web.bind.annotation.*;

/**
 * @author huangp
 * @create 2021-04-07 20:19
 */
@RestController
@RequestMapping("contract")
public class ContractController extends BaseController{

    @RequestMapping("add")
    public ResultMassage add(@RequestBody Contract contract){
        this.contractService.add(contract);
        return ResultMassage.result(ResultEnum.SUCCESS_ADD);
    }

    @RequestMapping("query")
    public ResultMassage  query(ContractVo vo){
        return ResultMassage.result(ResultEnum.SUCCESS_SELECT,this.contractService.query(vo));
    }

    @RequestMapping("delete/{contractId}")
    public ResultMassage delete(@PathVariable("contractId") Integer contractId){
        this.contractService.delete(contractId);
        return ResultMassage.result(ResultEnum.SUCCESS_DELETE);
    }

    @RequestMapping("update")
    public ResultMassage update(@RequestBody Contract contract){
        this.contractService.update(contract);
        return ResultMassage.result(ResultEnum.SUCCESS_UPDATE);
    }

}
